package ldh.msg.ui.helper;

import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JToolBar;

public class GridBagLayout2 extends GridBagLayout {
	public void addLayoutComponent(Component comp, Object constraints) {
		if (constraints instanceof GridBagConstraints) {
			super.addLayoutComponent(comp,constraints);
		} else {
//			String str=constraints.toString();
//			System.err.println(str);
//			if (str.equals("West")) {
//			}
//			else if (str.equals("East")) {
//			}
//			else if (str.equals("South")) {
//			}
//			else if (str.equals("North")) {
			
				GridBagConstraints gbc = new GridBagConstraints();
				gbc.gridx = 0;
				gbc.gridy = 0;
				gbc.weightx = 1;
//				gbc.weighty = 1;
				gbc.fill = GridBagConstraints.HORIZONTAL;
				gbc.anchor = GridBagConstraints.WEST;
				gbc.insets = new Insets(5, 5, 5, 5);
				if (comp instanceof JToolBar) {
					((JToolBar)comp).setOrientation(JToolBar.HORIZONTAL);
				}
				super.addLayoutComponent(comp, gbc);
//			}
		}
	}
}
